
using System;

namespace Stunt.Nutss
{

	/// <summary>Represents a continuation for an event-driven state machine</summary>
	public interface IContinuation
	{
		/// <summary>Steps the continuation by one step.</summary>
		/// <param name="o">Event causing continuation step. null for timeout.</param>
		/// <param name="d">Dispatch</param>
		/// <returns>timeout for current stage in milliseconds</returns>
		int Step(object o, Dispatch d);
		/// <summary>Initializes the continuation.</summary>
		/// <param name="arg">Signaling message the continuation is generated in response to. May be null.</param>
		/// <returns> Signaling message to match future messages of interest</returns>
		ISignalingMessage Init(ISignalingMessage arg);

		/// <summary>Cancels the continuation. Continuation will never be called again.</summary>
		/// <param name="d">Dispatch</param>
		void Cancel(Dispatch d);
	}
}